<?php
/**
 * Notes:
 * Created by PhpStorm.
 * Author: TS
 * Date: 2019/11/10
 * Time: 20:23
 */

namespace app\model;


use think\Model;

class TaskStage extends  Model
{
    public function add($data){
        return self::create($data);
    }
    public function del($task_stage_id){
        return self::get($task_stage_id)->delete();
    }
    public function edit($task_stage_id,$data){
        return self::update($data,['task_stage_id' => $task_stage_id]);
    }
    public function getByTask($task_id){
        return self::where(['task_id' => $task_id])->order('task_progress','desc')->select();
    }
    public function getStageTimeAttr($value){
        return date('Y-m-d H:i:s', $value);
    }

}